<html>
<head><meta charset="utf-8"><title>Tools for measuring memory usage? · t-compiler/performance · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/index.html">t-compiler/performance</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html">Tools for measuring memory usage?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="216741376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216741376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216741376">(Nov 14 2020 at 17:52)</a>:</h4>
<p>I know for times/instruction counts I can use <code>-Z self-profile</code> and various other flags. Is there a flag to measure memory usage?</p>



<a name="216741591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216741591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216741591">(Nov 14 2020 at 17:56)</a>:</h4>
<p>Memory usage is not yet tracked. I've heard good things about heaptrack (<a href="https://github.com/KDE/heaptrack">https://github.com/KDE/heaptrack</a>) but haven't really used it myself. dhat and similar tooling from valgrind can also be useful.</p>



<a name="216742024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742024">(Nov 14 2020 at 18:08)</a>:</h4>
<p>context: rustdoc uses 3.5 GB (!!) to document stm32f3 <a href="https://github.com/rust-lang/docs.rs/issues/1179">https://github.com/rust-lang/docs.rs/issues/1179</a></p>



<a name="216742088"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742088" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742088">(Nov 14 2020 at 18:10)</a>:</h4>
<p>I saw :)</p>



<a name="216742107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742107">(Nov 14 2020 at 18:11)</a>:</h4>
<div class="codehilite"><pre><span></span><code>$ heaptrack $(rustup which rustdoc) src/lib.rs
free(): invalid pointer
</code></pre></div>
<p>well that's exciting</p>



<a name="216742145"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742145" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742145">(Nov 14 2020 at 18:12)</a>:</h4>
<p>is that a nightly rustdoc?</p>



<a name="216742151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742151">(Nov 14 2020 at 18:12)</a>:</h4>
<p>you might want to build one in stage1, which won't use valgrind</p>



<a name="216742152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742152">(Nov 14 2020 at 18:12)</a>:</h4>
<p>yes, rustdoc 1.50.0-nightly (74f7e32f4 2020-11-13)</p>



<a name="216742155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742155">(Nov 14 2020 at 18:12)</a>:</h4>
<p>er, not valgrind</p>



<a name="216742156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742156">(Nov 14 2020 at 18:12)</a>:</h4>
<p>jemalloc</p>



<a name="216742160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742160">(Nov 14 2020 at 18:12)</a>:</h4>
<p>(stage 2 should be fine as well. the point is, not a nightly build)</p>



<a name="216742170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742170">(Nov 14 2020 at 18:13)</a>:</h4>
<p>I'll give it a try, thanks!</p>



<a name="216742180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742180">(Nov 14 2020 at 18:13)</a>:</h4>
<p>hmm, same error there</p>



<a name="216742185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742185">(Nov 14 2020 at 18:13)</a>:</h4>
<p>huh. well.</p>



<a name="216742226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742226">(Nov 14 2020 at 18:14)</a>:</h4>
<p>and another error about <code>core</code> not being built for the cross-compiled target, but I don't think that's relevant</p>



<a name="216742227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742227">(Nov 14 2020 at 18:14)</a>:</h4>
<p>I know that I have made heaptrack work before</p>



<a name="216742228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742228">(Nov 14 2020 at 18:14)</a>:</h4>
<p>are you on linux?</p>



<a name="216742230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742230">(Nov 14 2020 at 18:14)</a>:</h4>
<p>yeah, this is debian 10</p>



<a name="216742233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742233">(Nov 14 2020 at 18:14)</a>:</h4>
<p>it does emit a file, it just also has an invalid free along the way</p>



<a name="216742245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742245">(Nov 14 2020 at 18:15)</a>:</h4>
<p>and it has peak usage of 3.30 GB which seems about right, so maybe I can just ignore the double free for now</p>



<a name="216742247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742247">(Nov 14 2020 at 18:15)</a>:</h4>
<p>You will have to built rust from source, without jemalloc.</p>



<a name="216742250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742250">(Nov 14 2020 at 18:15)</a>:</h4>
<p><span class="user-mention" data-user-id="119581">@mati865</span> right, I did</p>



<a name="216742256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742256">(Nov 14 2020 at 18:15)</a>:</h4>
<div class="codehilite"><pre><span></span><code>total runtime: 129.21s.
bytes allocated in total (ignoring deallocations): 33.72GB (260.99MB/s)
calls to allocation functions: 117908219 (912559/s)
temporary memory allocations: 27242434 (210844/s)
peak heap memory consumption: 3.30GB
peak RSS (including heaptrack overhead): 35.85GB
total memory leaked: 562.85KB
</code></pre></div>
<p>wow that is just so much <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="216742334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742334">(Nov 14 2020 at 18:17)</a>:</h4>
<p>I had no issues with heaptrack and Rust, wonder what it could cause it.</p>



<a name="216742506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742506">(Nov 14 2020 at 18:22)</a>:</h4>
<p>ok, a full gigabyte of this is coming from <code>get_auto_trait_and_blanket_impls</code></p>



<a name="216742512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742512">(Nov 14 2020 at 18:22)</a>:</h4>
<p>hmm that sounds like <a href="https://github.com/rust-lang/rust/issues/78761">https://github.com/rust-lang/rust/issues/78761</a></p>



<a name="216742515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742515">(Nov 14 2020 at 18:22)</a>:</h4>
<p>fwiw I am also seeing this free invalid ptr on 20.04 ubuntu</p>



<a name="216742560"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742560" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742560">(Nov 14 2020 at 18:24)</a>:</h4>
<p>seems to come from libheaptrack_preload</p>



<a name="216742573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742573">(Nov 14 2020 at 18:24)</a>:</h4>
<p>possibly trying to unload dynamic libraries?</p>



<a name="216742574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742574">(Nov 14 2020 at 18:24)</a>:</h4>
<div class="codehilite"><pre><span></span><code>#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007fcf23298859 in __GI_abort () at abort.c:79
#2  0x00007fcf233033ee in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7fcf2342d285 &quot;%s\n&quot;)
    at ../sysdeps/posix/libc_fatal.c:155
#3  0x00007fcf2330b47c in malloc_printerr (str=str@entry=0x7fcf2342b4ae &quot;free(): invalid pointer&quot;) at malloc.c:5347
#4  0x00007fcf2330ccac in _int_free (av=&lt;optimized out&gt;, p=&lt;optimized out&gt;, have_lock=0) at malloc.c:4173
#5  0x00007fcf27b6ff53 in free () from /usr/lib/heaptrack/libheaptrack_preload.so
#6  0x00007fcf2326ecfd in free_key_mem (mem=0x7fcf27b79280) at dlerror.c:230
#7  __dlerror_main_freeres () at dlerror.c:251
#8  0x00007fcf2326f179 in __libdl_freeres () at dlfreeres.c:28
#9  0x00007fcf2340eada in __GI___libc_freeres () at set-freeres.c:52
#10 0x00007fcf27b71c31 in ?? () from /usr/lib/heaptrack/libheaptrack_preload.so
#11 0x00007fcf232bd15e in __cxa_finalize (d=0x7fcf27b79218) at cxa_finalize.c:83
#12 0x00007fcf27b6faf7 in ?? () from /usr/lib/heaptrack/libheaptrack_preload.so
#13 0x00007ffd14d744c0 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
</code></pre></div>



<a name="216742659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742659">(Nov 14 2020 at 18:27)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> ok, maybe I'm breaking something, but I'm seeing radically different memory usage</p>



<a name="216742661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742661">(Nov 14 2020 at 18:27)</a>:</h4>
<p>like 100MB</p>



<a name="216742694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742694">(Nov 14 2020 at 18:28)</a>:</h4>
<p>This is on stm32f3 from the nightlies thing</p>



<a name="216742710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742710">(Nov 14 2020 at 18:28)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> you need to enable all the features</p>
<div class="codehilite"><pre><span></span><code>$ cargo doc --features &quot;rt stm32f303 stm32f373 stm32f3x8&quot; --target thumbv7em-none-eabihf
</code></pre></div>



<a name="216742711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742711">(Nov 14 2020 at 18:28)</a>:</h4>
<p>ah, I see</p>



<a name="216742712"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742712" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742712">(Nov 14 2020 at 18:28)</a>:</h4>
<p>without those the crate is almost empty</p>



<a name="216742734"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742734" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742734">(Nov 14 2020 at 18:29)</a>:</h4>
<p>here let me post my profile somewhere</p>



<a name="216742800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742800">(Nov 14 2020 at 18:31)</a>:</h4>
<p>it's about 90 MB so if you have slow internet it may be faster just to collect the profile yourself: <a href="https://drive.google.com/file/d/150bpmBp7F7G87Wuue70D_edSOFgUn1Gu/view?usp=sharing">https://drive.google.com/file/d/150bpmBp7F7G87Wuue70D_edSOFgUn1Gu/view?usp=sharing</a></p>



<a name="216742819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216742819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216742819">(Nov 14 2020 at 18:31)</a>:</h4>
<p>oh yeah I'm recollecting now, it's pretty fast to do so</p>



<a name="216743214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216743214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216743214">(Nov 14 2020 at 18:38)</a>:</h4>
<p>so one thing that pops out is that this has <em>terrible</em> time complexity</p>



<a name="216743221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216743221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216743221">(Nov 14 2020 at 18:38)</a>:</h4>
<div class="codehilite"><pre><span></span><code>for every item in the crate:
  for every trait in the crate:
    for every impl for the trait:
        do a heavy computation with `infer_ctxt`
</code></pre></div>



<a name="216743548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216743548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216743548">(Nov 14 2020 at 18:44)</a>:</h4>
<p>an easy improvement could be for <code>get_all_types</code> to return a HashMap instead of constantly calling <code>into_iter().collect()</code></p>



<a name="216743554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216743554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216743554">(Nov 14 2020 at 18:44)</a>:</h4>
<p>that's more performance than memory usage though</p>



<a name="216743686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216743686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216743686">(Nov 14 2020 at 18:46)</a>:</h4>
<p>I don't see <code>all_types</code> actually being used anywhere (??)</p>



<a name="216743725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216743725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216743725">(Nov 14 2020 at 18:47)</a>:</h4>
<p>At the very least flipping the top two for loops seems like a likely benefit</p>



<a name="216743736"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216743736" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216743736">(Nov 14 2020 at 18:48)</a>:</h4>
<p>oh it's used for the search index</p>



<a name="216743737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216743737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216743737">(Nov 14 2020 at 18:48)</a>:</h4>
<p>In most cases crates have way more items than traits</p>



<a name="216743795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216743795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216743795">(Nov 14 2020 at 18:48)</a>:</h4>
<p>Though I guess maybe the current setup is good for that</p>



<a name="216744046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216744046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216744046">(Nov 14 2020 at 18:52)</a>:</h4>
<p>so right now the callgraph looks like this: <a href="https://github.com/rust-lang/rust/blob/master/src/librustdoc/passes/collect_trait_impls.rs#L124"><code>SyntheticImplCollector</code></a> calls <code>get_auto_trait_and_blanket_impls</code> for each item in the crate, which then does the trait/impl loop</p>



<a name="216744068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216744068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216744068">(Nov 14 2020 at 18:53)</a>:</h4>
<p>I wonder if I could change that around to do the trait/impl loop for every trait in the crate</p>



<a name="216744079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216744079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216744079">(Nov 14 2020 at 18:53)</a>:</h4>
<p>I guess I wouldn't know where to get the def_id of the item from?</p>



<a name="216744145"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216744145" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216744145">(Nov 14 2020 at 18:54)</a>:</h4>
<p>So memory usage wise, the question I think is: do we need to keep all this around? Like, are we perhaps caching the results of the query but should instead be dropping it?</p>



<a name="216744159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216744159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216744159">(Nov 14 2020 at 18:55)</a>:</h4>
<p>well in general rustdoc shouldn't be storing these at all <a href="https://github.com/rust-lang/rust/issues/76382">https://github.com/rust-lang/rust/issues/76382</a></p>



<a name="216744166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216744166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216744166">(Nov 14 2020 at 18:55)</a>:</h4>
<p>it should be using them only once when they're needed</p>



<a name="216744244"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216744244" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216744244">(Nov 14 2020 at 18:56)</a>:</h4>
<p>doing that is another big refactor on top of my existing big refactors though:</p>
<ul>
<li><a href="https://github.com/rust-lang/rust/pull/77820">https://github.com/rust-lang/rust/pull/77820</a></li>
<li><a href="https://github.com/rust-lang/rust/pull/78082">https://github.com/rust-lang/rust/pull/78082</a></li>
</ul>



<a name="216744338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/216744338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#216744338">(Nov 14 2020 at 18:58)</a>:</h4>
<p>maybe I should finish up <a href="https://github.com/rust-lang/rust/pull/77820">https://github.com/rust-lang/rust/pull/77820</a> before working on this</p>



<a name="220076204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/220076204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#220076204">(Dec 16 2020 at 04:27)</a>:</h4>
<p>ok I spent most of the night on this without progress <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="220076209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/220076209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#220076209">(Dec 16 2020 at 04:27)</a>:</h4>
<p>mostly I found that get_blanket_impls takes a truly astronomical amount of time <a href="https://github.com/rust-lang/rust/issues/79103#issuecomment-745737864">https://github.com/rust-lang/rust/issues/79103#issuecomment-745737864</a></p>



<a name="220076211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/220076211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#220076211">(Dec 16 2020 at 04:27)</a>:</h4>
<p>which I kind of already knew</p>



<a name="220076635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/220076635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#220076635">(Dec 16 2020 at 04:36)</a>:</h4>
<p>sorry if someone's already mentioned this: Has anyone pointed you at <span class="user-mention" data-user-id="120989">@njn</span> 's latest tool here?</p>



<a name="220076702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/220076702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#220076702">(Dec 16 2020 at 04:38)</a>:</h4>
<p>namely dhat-rs : <a href="https://twitter.com/nnethercote/status/1336458477934239744">https://twitter.com/nnethercote/status/1336458477934239744</a></p>
<div class="inline-preview-twitter"><div class="twitter-tweet"><a href="https://twitter.com/nnethercote/status/1336458477934239744"><img class="twitter-avatar" src="https://pbs.twimg.com/profile_images/1296625446885314560/HvSi39Xi_normal.png"></a><p>I tweeted yesterday about dhat-rs, a crate for doing DHAT-style heap profiling in Rust programs.
<a href="https://t.co/oUloMdNJwK">https://twitter.com/nnethercote/status/1336132646020104193</a></p><span>- Nicholas Nethercote (@nnethercote)</span></div></div>



<a name="220076724"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/220076724" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#220076724">(Dec 16 2020 at 04:38)</a>:</h4>
<p>I guess that may not give you the fine grain detail of the compiler internals that you want, though?</p>



<a name="220076753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/220076753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#220076753">(Dec 16 2020 at 04:40)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> I ran that last week, that's been where most of the recent PRs came from: <a href="#narrow/stream/122651-general/topic/DHAT.20and.20rustdoc">https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/DHAT.20and.20rustdoc</a>, <a href="https://github.com/rust-lang/rust/pulls?q=is%3Apr+label%3AI-compilemem+author%3Ajyn514+">https://github.com/rust-lang/rust/pulls?q=is%3Apr+label%3AI-compilemem+author%3Ajyn514+</a></p>



<a name="220076792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/220076792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#220076792">(Dec 16 2020 at 04:40)</a>:</h4>
<p>unfortunately it takes almost an hour to run :(</p>



<a name="220076794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/220076794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#220076794">(Dec 16 2020 at 04:40)</a>:</h4>
<p>so I haven't tried to use it again</p>



<a name="220076796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/220076796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#220076796">(Dec 16 2020 at 04:40)</a>:</h4>
<p>oh okay, sorry for missing that</p>



<a name="220076803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/220076803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#220076803">(Dec 16 2020 at 04:40)</a>:</h4>
<p>no problem, I know I have a tendency to spew information everywhere without collecting it in one place <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="220076876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/220076876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#220076876">(Dec 16 2020 at 04:42)</a>:</h4>
<p>also, surprisingly, <code>heaptrack</code> reports that although most of the <em>time</em> comes from <code>get_blanket_impls</code>, the big <em>spike</em> in memory comes from <code>print_evaluated_const</code></p>



<a name="220076900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/220076900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#220076900">(Dec 16 2020 at 04:43)</a>:</h4>
<p>oh wait I might be reading that wrong</p>



<a name="220076903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/220076903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#220076903">(Dec 16 2020 at 04:43)</a>:</h4>
<p>I think that's just the call depth</p>



<a name="220076962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/220076962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#220076962">(Dec 16 2020 at 04:44)</a>:</h4>
<p>ok I take it back it is actually get_blanket_impls lol, and <code>try_inline</code> apparently</p>



<a name="220077048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/220077048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#220077048">(Dec 16 2020 at 04:46)</a>:</h4>
<p>I think this is from Item just being really big</p>



<a name="220077250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/220077250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#220077250">(Dec 16 2020 at 04:50)</a>:</h4>
<div class="codehilite"><pre><span></span><code>[src/librustdoc/lib.rs:103] std::mem::size_of::&lt;Item&gt;() = 656
</code></pre></div>



<a name="220077267"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Tools%20for%20measuring%20memory%20usage%3F/near/220077267" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Tools.20for.20measuring.20memory.20usage.3F.html#220077267">(Dec 16 2020 at 04:50)</a>:</h4>
<p>so yeah, I'll try this again after <a href="https://github.com/rust-lang/rust/pull/80014">https://github.com/rust-lang/rust/pull/80014</a> is merged</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>